package com.jinly.ryder.ansible.service.model;

import lombok.Data;

import java.util.List;

@Data
public class AnsibleDeployResult {
    private boolean success = true;
    private List<AnsibleTask> taskList;
    private String output;

    public void setTaskList(List<AnsibleTask> taskList) {
        this.taskList = taskList;
        if (taskList == null || taskList.size() == 0) this.success = false;
        if (taskList.stream().anyMatch(t -> !t.isRun() || "fatal".equals(t.getResult()))) this.success = false;
    }
}
